package com.rao.gmall.feign.cart;

import com.rao.gmall.common.result.Result;
import com.rao.gmall.feign.cart.fallback.CartFeignClientFallback;
import com.rao.gmall.model.cart.CartInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author nzmxfan
 * @create 2021-08-17-18:56
 */
@FeignClient(value = "service-cart", fallback = CartFeignClientFallback.class)
@RequestMapping("/api/cart")
public interface CartFeignClient {

    @GetMapping("/addToCart")
    CartInfo addToCart(@RequestParam("skuId") Long skuId,
                       @RequestParam("skuNum") Integer skuNum);

    @GetMapping("/isCheckList")
    List<CartInfo> getCartIsCheckList();

    @DeleteMapping("/deleteBySkuIds")
    Result deleteSkuFromCart(@RequestParam List<String> skuIds);
}
